function userLogin() {
    var username = $("#username").val();
    console.log(username);
    var password = $("#password").val();
    console.log(password);
    var param = {
        username:username,
        password:password
    };
    $.ajax({
        url: '/user/login',
        type:"POST",
        dataType: "json",
        contentType: "application/json;charset=utf-8",
        async: false,
        data: JSON.stringify(param),
        success: function (res) {
            console.log(res.success);
            if (res.success) {
                //登陆成功直接进入好友列表页
                var friendParam = {
                    username:username
                };
                $.ajax({
                    url: '/user/friendList',
                    type:"POST",
                    dataType: "json",
                    async: false,
                    contentType: "application/json;charset=utf-8",
                    data: JSON.stringify(friendParam),
                    success: function (res) {
                        console.log(res.success);
                        if (res.success) {
                            //登陆成功直接进入好友列表页
                            window.location.href="/friend.html";
                        }else {
                            $('.errorMessage').html(res.message)
                        }
                    }
                });
            }else {
                // alert("登录失败");
                $('.errorMessage').html(res.message)
            }
        }
    });
}